package com.dbw.englishassistant.ui.tool;

import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.Insets;

public class GridBagLayoutTool {

    public static void add(Container main, Container child, 
            int gridx, int gridy, double weightx, double weighty) {
        GridBagConstraints c = new GridBagConstraints();
        c.gridx = gridx;
        c.gridy = gridy;
        c.gridwidth = 1;
        c.gridheight = 1;
        c.weightx = weightx;
        c.weighty = weighty;
        c.fill = GridBagConstraints.BOTH;
        main.add(child, c);
    }
    
    public static void add(Container main, Container child, 
            int gridx, int gridy, double weightx, double weighty, Insets insets) {
        GridBagConstraints c = new GridBagConstraints();
        c.gridx = gridx;
        c.gridy = gridy;
        c.gridwidth = 1;
        c.gridheight = 1;
        c.weightx = weightx;
        c.weighty = weighty;
        c.fill = GridBagConstraints.BOTH;
        c.insets = insets;
        main.add(child, c);
    }

    public static void add(Container main, Container child, 
            int gridx, int gridy, int gridWidth, int gridHeight,
            double weightx, double weighty) {
        GridBagConstraints c = new GridBagConstraints();
        c.gridx = gridx;
        c.gridy = gridy;
        c.gridwidth = gridWidth;
        c.gridheight = gridHeight;
        c.weightx = weightx;
        c.weighty = weighty;
        c.fill = GridBagConstraints.BOTH;
        main.add(child, c);
    }

    public static void add(Container main, Container child, 
            int gridx, int gridy, int gridWidth, int gridHeight,
            double weightx, double weighty, Insets insets) {
        GridBagConstraints c = new GridBagConstraints();
        c.gridx = gridx;
        c.gridy = gridy;
        c.gridwidth = gridWidth;
        c.gridheight = gridHeight;
        c.weightx = weightx;
        c.weighty = weighty;
        c.fill = GridBagConstraints.BOTH;
        c.insets = insets;
        main.add(child, c);
    }
}
